package com.telecom.weixi.parse;

import android.os.Parcel;
import android.os.Parcelable;

public class TerminalDetailInfo implements Parcelable{
	String content;
	int pos;
	String regTime;
	private String contentTitle;
	private String contentValue;
	
	public TerminalDetailInfo(){
		
	}
	
	public TerminalDetailInfo(Parcel source){
		pos = source.readInt();
		regTime = source.readString();
		contentTitle = source.readString();
		contentValue = source.readString();
	}
	
	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeInt(pos);
		dest.writeString(regTime);
		dest.writeString(contentTitle);
		dest.writeString(contentValue);
	}
	
	public static Parcelable.Creator<TerminalDetailInfo> CREATOR = new Creator<TerminalDetailInfo>(){

		@Override
		public TerminalDetailInfo createFromParcel(Parcel source) {
			return new TerminalDetailInfo(source);
		}

		@Override
		public TerminalDetailInfo[] newArray(int size) {
			return new TerminalDetailInfo[size];
		}
		
	};
	
	public String toString(){
		return pos + "-" + content + "-" + regTime;
	}
	
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
		String[] parts = content.split(":");
		if(parts.length > 0){
			setContentTitle(parts[0]);
		}
		if(parts.length > 1){
			setContentValue(parts[1]);
		}
	}
	
	public int getPos() {
		return pos;
	}
	public void setPos(int pos) {
		this.pos = pos;
	}
	public String getRegTime() {
		return regTime;
	}
	public void setRegTime(String regTime) {
		String[] splitPart = regTime.split(" ");
		this.regTime = splitPart[0];
	}

	public String getContentTitle() {
		return contentTitle;
	}

	private void setContentTitle(String contentTitle) {
		this.contentTitle = contentTitle;
	}

	public String getContentValue() {
		return contentValue;
	}

	private void setContentValue(String contentValue) {
		this.contentValue = contentValue;
	}

}
